package com.jz.legalplantclass.mapper;

//import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.jz.legalplantclass.entity.LegalPlantClassAddVo;
import com.jz.legalplantclass.entity.LegalVO;
import com.jz.legalplantclass.entity.Legalplantclass;
import com.jz.planclass.model.PlanClassVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2021-12-30
 */
@Mapper
public interface LegalplantclassMapper {
    @Select("select * from legalplantclass where legalPlantCode = #{legalPlantCode}")
    Legalplantclass queryByLegalPlantCode(@NotBlank(message = "工厂编码不能为空") String legalPlantCode);

    @Select("select * from legalplantclass where id = #{id}")
    Legalplantclass queryById(@NotNull(message = "ID不能为空") Integer id);

    @Update("update legalplantclass set enabled = #{enabled},updateTime = #{updateTime},updateName = #{updateName} where id = #{id} ")
    void updateEnabled(LegalVO legalVO);

    @Update("update legalplantclass set legalPlantDec = #{legalPlantDec},enabled = #{enabled},updateTime = #{updateTime},updateName = #{updateName},version = #{version}+1 where id = #{id} and version = #{version}")
    int updateLegalPlantClass(LegalVO legalVO);
}
